<?php

namespace FrontModule;

class VzorkovnaPresenter extends FrontPresenter {

    public function renderDefault() {
        $showroomModel = new \AdminModule\Models\Showroom($this->db);
        $this->template->showrooms = $showroomModel->order('title')->where('published = ?' , true);
    }
    
    public function renderDetail($id, $koje) {
        $showroomModel = new \AdminModule\Models\Showroom($this->db);
        $showroom = $showroomModel->get($id);        
        if (!\is_object($showroom)) {
            $this->flashMessage('Kóje s požadovaným id neexistuje', 'error');
            $this->redirect('default');
        }        
        $this->template->showroom = $showroom;
    }

}
